<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Complaint.Models.Dtos.Organisation>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>
        <%= Model.Name %></title>
    <meta name="description" content="Details of <%= Model.Name %>" />
    <meta name="keywords" content="complain,<%= Model.Name %>,organisation,detials" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Details of
        <%= Model.Name %></h2>
    <div id="orgInfoHolder">
        <fieldset>
            <legend>Basic info</legend>
            <p>
                Name:
                <%= Html.Encode(Model.Name) %>
            </p>
            <p>
                CustomerCareEmail:
                <%= Html.Encode(Model.CustomerCareEmail) %>
            </p>
            <p>
                Tel:
                <%= Html.Encode(Model.Tel) %>
            </p>
            <p>
                Website:
                <%= Html.Encode(Model.Website) %>
            </p>
            <p>
                Address line 1:
                <%= Html.Encode(Model.Address1) %>
            </p>
            <p>
                Address line 2:
                <%= Html.Encode(Model.Address2) %>
            </p>
            <p>
                City:
                <%= Html.Encode(Model.City) %>
            </p>
            <p>
                Country:
                <%= Html.Encode(Model.Country) %>
            </p>
            <p>
                Postcode:
                <%= Html.Encode(Model.Postcode) %>
            </p>
            <p>
                DateAdded:
                <%= Html.Encode(String.Format("{0:g}", Model.DateAdded)) %>
            </p>
            <%--        <p>
            Status:
            <%= Html.Encode(Model.Status) %>
        </p>
        <p>
            IsValid:
            <%= Html.Encode(Model.IsValid) %>
        </p>
--%>
        </fieldset>
    </div>
    <div id="categoryHolder">
        <fieldset>
            <legend>Categories</legend>
            <%if (Model.Category.Count > 0)
              {%>
            <ul>
                <%foreach (var c in Model.Category)
                  {%>
                <li>
                    <%=Html.Encode(c.Title)%></li>
                <%}%>
            </ul>
            <% }
              else
              {%>
            <p>
                None</p>
            <%  } %>
        </fieldset>
    </div>
    <div id="aliasHolder">
        <fieldset>
            <legend>Aliases</legend>
            <%if (Model.OrganisationAlias.Count > 0)
              {%>
            <ul>
                <%  foreach (var a in Model.OrganisationAlias)
                    {%>
                <li>
                    <%= Html.Encode(a.Alias)%></li>
                <%  } %>
            </ul>
            <% }
              else
              {%>
            <p>
                None</p>
            <%  } %>
        </fieldset>
    </div>
    <div id="contactHolder">
        <fieldset>
            <legend>Contacts</legend>
            <% Html.RenderPartial("ContactList", Model.Contact.ToList(),
           new ViewDataDictionary(new ViewDataDictionary() { { "OrganisationID", Model.OrganisationID } })); %>
        </fieldset>
    </div>
    <p>
        <%--        <%=Html.ActionLink("Edit", "Edit", new { id=Model.OrganisationID }) %> |--%>
        <%=Html.ActionLink("Complain", "Create", "Complaint", new { id = Model.OrganisationID }, new { })%>
        |
        <%=Html.ActionLink("View complaints", "SearchByOrganisation", "Complaint", new { id = Model.OrganisationID }, new { })%>
        |
        <%=Html.ActionLink("Back to List", "Index") %>
    </p>
</asp:Content>
